home *** CD-ROM | disk | FTP | other *** search
/ Delphi Magazine Collection 2001 / Delphi Magazine Collection 20001 (2001).iso / Bonus / VCLZip / kp222_b3.exe / VCLUnZip.hpp < prev    next >
Encoding:
C/C++ Source or Header  |  2001-07-23  |  29.3 KB  |  611 lines

  1. // Borland C++ Builder
  2. // Copyright (c) 1995, 1998 by Borland International
  3. // All rights reserved
  4.  
  5. // (DO NOT EDIT: machine generated header) 'VCLUnZip.pas' rev: 3.00
  6.  
  7. #ifndef VCLUnZipHPP
  8. #define VCLUnZipHPP
  9. #include <kpZcnst.hpp>
  10. #include <kpZipObj.hpp>
  11. #include <KpLib.hpp>
  12. #include <kpMatch.hpp>
  13. #include <kpCntn.hpp>
  14. #include <FileCtrl.hpp>
  15. #include <Dialogs.hpp>
  16. #include <Forms.hpp>
  17. #include <Controls.hpp>
  18. #include <Classes.hpp>
  19. #include <SysUtils.hpp>
  20. #include <Windows.hpp>
  21. #include <SysInit.hpp>
  22. #include <System.hpp>
  23.  
  24. //-- user supplied -----------------------------------------------------------
  25.  
  26. namespace Vclunzip
  27. {
  28. //-- type declarations -------------------------------------------------------
  29. enum TMultiMode { mmNone, mmSpan, mmBlocks };
  30.  
  31. enum TIncompleteZipMode { izAssumeMulti, izAssumeBad, izAssumeNotAZip };
  32.  
  33. enum TUZOverwriteMode { Prompt, Always, Never, ifNewer, ifOlder };
  34.  
  35. enum TSkipReason { srBadPassword, srNoOverwrite, srFileOpenError, srCreateError };
  36.  
  37. typedef int DecryptKey[3];
  38.  
  39. typedef Byte DecryptHeaderType[12];
  40.  
  41. typedef DecryptHeaderType *DecryptHeaderPtr;
  42.  
  43. class DELPHICLASS EBadZipFile;
  44. class PASCALIMPLEMENTATION EBadZipFile : public Sysutils::Exception 
  45. {
  46.     typedef Sysutils::Exception inherited;
  47.     
  48. public:
  49.     /* Exception.Create */ __fastcall EBadZipFile(const System::AnsiString Msg) : Sysutils::Exception(Msg
  50.         ) { }
  51.     /* Exception.CreateFmt */ __fastcall EBadZipFile(const System::AnsiString Msg, const System::TVarRec 
  52.         * Args, const int Args_Size) : Sysutils::Exception(Msg, Args, Args_Size) { }
  53.     /* Exception.CreateRes */ __fastcall EBadZipFile(int Ident, Extended Dummy) : Sysutils::Exception(Ident
  54.         , Dummy) { }
  55.     /* Exception.CreateResFmt */ __fastcall EBadZipFile(int Ident, const System::TVarRec * Args, const 
  56.         int Args_Size) : Sysutils::Exception(Ident, Args, Args_Size) { }
  57.     /* Exception.CreateHelp */ __fastcall EBadZipFile(const System::AnsiString Msg, int AHelpContext) : 
  58.         Sysutils::Exception(Msg, AHelpContext) { }
  59.     /* Exception.CreateFmtHelp */ __fastcall EBadZipFile(const System::AnsiString Msg, const System::TVarRec 
  60.         * Args, const int Args_Size, int AHelpContext) : Sysutils::Exception(Msg, Args, Args_Size, AHelpContext
  61.         ) { }
  62.     /* Exception.CreateResHelp */ __fastcall EBadZipFile(int Ident, int AHelpContext) : Sysutils::Exception(
  63.         Ident, AHelpContext) { }
  64.     /* Exception.CreateResFmtHelp */ __fastcall EBadZipFile(int Ident, const System::TVarRec * Args, const 
  65.         int Args_Size, int AHelpContext) : Sysutils::Exception(Ident, Args, Args_Size, AHelpContext) { }
  66.     
  67. public:
  68.     /* TObject.Destroy */ __fastcall virtual ~EBadZipFile(void) { }
  69.     
  70. };
  71.  
  72. class DELPHICLASS EFileNotAllThere;
  73. class PASCALIMPLEMENTATION EFileNotAllThere : public Sysutils::Exception 
  74. {
  75.     typedef Sysutils::Exception inherited;
  76.     
  77. public:
  78.     /* Exception.Create */ __fastcall EFileNotAllThere(const System::AnsiString Msg) : Sysutils::Exception(
  79.         Msg) { }
  80.     /* Exception.CreateFmt */ __fastcall EFileNotAllThere(const System::AnsiString Msg, const System::TVarRec 
  81.         * Args, const int Args_Size) : Sysutils::Exception(Msg, Args, Args_Size) { }
  82.     /* Exception.CreateRes */ __fastcall EFileNotAllThere(int Ident, Extended Dummy) : Sysutils::Exception(
  83.         Ident, Dummy) { }
  84.     /* Exception.CreateResFmt */ __fastcall EFileNotAllThere(int Ident, const System::TVarRec * Args, const 
  85.         int Args_Size) : Sysutils::Exception(Ident, Args, Args_Size) { }
  86.     /* Exception.CreateHelp */ __fastcall EFileNotAllThere(const System::AnsiString Msg, int AHelpContext
  87.         ) : Sysutils::Exception(Msg, AHelpContext) { }
  88.     /* Exception.CreateFmtHelp */ __fastcall EFileNotAllThere(const System::AnsiString Msg, const System::TVarRec 
  89.         * Args, const int Args_Size, int AHelpContext) : Sysutils::Exception(Msg, Args, Args_Size, AHelpContext
  90.         ) { }
  91.     /* Exception.CreateResHelp */ __fastcall EFileNotAllThere(int Ident, int AHelpContext) : Sysutils::
  92.         Exception(Ident, AHelpContext) { }
  93.     /* Exception.CreateResFmtHelp */ __fastcall EFileNotAllThere(int Ident, const System::TVarRec * Args
  94.         , const int Args_Size, int AHelpContext) : Sysutils::Exception(Ident, Args, Args_Size, AHelpContext
  95.         ) { }
  96.     
  97. public:
  98.     /* TObject.Destroy */ __fastcall virtual ~EFileNotAllThere(void) { }
  99.     
  100. };
  101.  
  102. class DELPHICLASS EIncompleteZip;
  103. class PASCALIMPLEMENTATION EIncompleteZip : public Sysutils::Exception 
  104. {
  105.     typedef Sysutils::Exception inherited;
  106.     
  107. public:
  108.     /* Exception.Create */ __fastcall EIncompleteZip(const System::AnsiString Msg) : Sysutils::Exception(
  109.         Msg) { }
  110.     /* Exception.CreateFmt */ __fastcall EIncompleteZip(const System::AnsiString Msg, const System::TVarRec 
  111.         * Args, const int Args_Size) : Sysutils::Exception(Msg, Args, Args_Size) { }
  112.     /* Exception.CreateRes */ __fastcall EIncompleteZip(int Ident, Extended Dummy) : Sysutils::Exception(
  113.         Ident, Dummy) { }
  114.     /* Exception.CreateResFmt */ __fastcall EIncompleteZip(int Ident, const System::TVarRec * Args, const 
  115.         int Args_Size) : Sysutils::Exception(Ident, Args, Args_Size) { }
  116.     /* Exception.CreateHelp */ __fastcall EIncompleteZip(const System::AnsiString Msg, int AHelpContext
  117.         ) : Sysutils::Exception(Msg, AHelpContext) { }
  118.     /* Exception.CreateFmtHelp */ __fastcall EIncompleteZip(const System::AnsiString Msg, const System::TVarRec 
  119.         * Args, const int Args_Size, int AHelpContext) : Sysutils::Exception(Msg, Args, Args_Size, AHelpContext
  120.         ) { }
  121.     /* Exception.CreateResHelp */ __fastcall EIncompleteZip(int Ident, int AHelpContext) : Sysutils::Exception(
  122.         Ident, AHelpContext) { }
  123.     /* Exception.CreateResFmtHelp */ __fastcall EIncompleteZip(int Ident, const System::TVarRec * Args, 
  124.         const int Args_Size, int AHelpContext) : Sysutils::Exception(Ident, Args, Args_Size, AHelpContext)
  125.          { }
  126.     
  127. public:
  128.     /* TObject.Destroy */ __fastcall virtual ~EIncompleteZip(void) { }
  129.     
  130. };
  131.  
  132. class DELPHICLASS ENotAZipFile;
  133. class PASCALIMPLEMENTATION ENotAZipFile : public Sysutils::Exception 
  134. {
  135.     typedef Sysutils::Exception inherited;
  136.     
  137. public:
  138.     /* Exception.Create */ __fastcall ENotAZipFile(const System::AnsiString Msg) : Sysutils::Exception(
  139.         Msg) { }
  140.     /* Exception.CreateFmt */ __fastcall ENotAZipFile(const System::AnsiString Msg, const System::TVarRec 
  141.         * Args, const int Args_Size) : Sysutils::Exception(Msg, Args, Args_Size) { }
  142.     /* Exception.CreateRes */ __fastcall ENotAZipFile(int Ident, Extended Dummy) : Sysutils::Exception(
  143.         Ident, Dummy) { }
  144.     /* Exception.CreateResFmt */ __fastcall ENotAZipFile(int Ident, const System::TVarRec * Args, const 
  145.         int Args_Size) : Sysutils::Exception(Ident, Args, Args_Size) { }
  146.     /* Exception.CreateHelp */ __fastcall ENotAZipFile(const System::AnsiString Msg, int AHelpContext) : 
  147.         Sysutils::Exception(Msg, AHelpContext) { }
  148.     /* Exception.CreateFmtHelp */ __fastcall ENotAZipFile(const System::AnsiString Msg, const System::TVarRec 
  149.         * Args, const int Args_Size, int AHelpContext) : Sysutils::Exception(Msg, Args, Args_Size, AHelpContext
  150.         ) { }
  151.     /* Exception.CreateResHelp */ __fastcall ENotAZipFile(int Ident, int AHelpContext) : Sysutils::Exception(
  152.         Ident, AHelpContext) { }
  153.     /* Exception.CreateResFmtHelp */ __fastcall ENotAZipFile(int Ident, const System::TVarRec * Args, const 
  154.         int Args_Size, int AHelpContext) : Sysutils::Exception(Ident, Args, Args_Size, AHelpContext) { }
  155.     
  156. public:
  157.     /* TObject.Destroy */ __fastcall virtual ~ENotAZipFile(void) { }
  158.     
  159. };
  160.  
  161. class DELPHICLASS EFatalUnzipError;
  162. class PASCALIMPLEMENTATION EFatalUnzipError : public Sysutils::Exception 
  163. {
  164.     typedef Sysutils::Exception inherited;
  165.     
  166. public:
  167.     /* Exception.Create */ __fastcall EFatalUnzipError(const System::AnsiString Msg) : Sysutils::Exception(
  168.         Msg) { }
  169.     /* Exception.CreateFmt */ __fastcall EFatalUnzipError(const System::AnsiString Msg, const System::TVarRec 
  170.         * Args, const int Args_Size) : Sysutils::Exception(Msg, Args, Args_Size) { }
  171.     /* Exception.CreateRes */ __fastcall EFatalUnzipError(int Ident, Extended Dummy) : Sysutils::Exception(
  172.         Ident, Dummy) { }
  173.     /* Exception.CreateResFmt */ __fastcall EFatalUnzipError(int Ident, const System::TVarRec * Args, const 
  174.         int Args_Size) : Sysutils::Exception(Ident, Args, Args_Size) { }
  175.     /* Exception.CreateHelp */ __fastcall EFatalUnzipError(const System::AnsiString Msg, int AHelpContext
  176.         ) : Sysutils::Exception(Msg, AHelpContext) { }
  177.     /* Exception.CreateFmtHelp */ __fastcall EFatalUnzipError(const System::AnsiString Msg, const System::TVarRec 
  178.         * Args, const int Args_Size, int AHelpContext) : Sysutils::Exception(Msg, Args, Args_Size, AHelpContext
  179.         ) { }
  180.     /* Exception.CreateResHelp */ __fastcall EFatalUnzipError(int Ident, int AHelpContext) : Sysutils::
  181.         Exception(Ident, AHelpContext) { }
  182.     /* Exception.CreateResFmtHelp */ __fastcall EFatalUnzipError(int Ident, const System::TVarRec * Args
  183.         , const int Args_Size, int AHelpContext) : Sysutils::Exception(Ident, Args, Args_Size, AHelpContext
  184.         ) { }
  185.     
  186. public:
  187.     /* TObject.Destroy */ __fastcall virtual ~EFatalUnzipError(void) { }
  188.     
  189. };
  190.  
  191. class DELPHICLASS EUserCanceled;
  192. class PASCALIMPLEMENTATION EUserCanceled : public Sysutils::Exception 
  193. {
  194.     typedef Sysutils::Exception inherited;
  195.     
  196. public:
  197.     /* Exception.Create */ __fastcall EUserCanceled(const System::AnsiString Msg) : Sysutils::Exception(
  198.         Msg) { }
  199.     /* Exception.CreateFmt */ __fastcall EUserCanceled(const System::AnsiString Msg, const System::TVarRec 
  200.         * Args, const int Args_Size) : Sysutils::Exception(Msg, Args, Args_Size) { }
  201.     /* Exception.CreateRes */ __fastcall EUserCanceled(int Ident, Extended Dummy) : Sysutils::Exception(
  202.         Ident, Dummy) { }
  203.     /* Exception.CreateResFmt */ __fastcall EUserCanceled(int Ident, const System::TVarRec * Args, const 
  204.         int Args_Size) : Sysutils::Exception(Ident, Args, Args_Size) { }
  205.     /* Exception.CreateHelp */ __fastcall EUserCanceled(const System::AnsiString Msg, int AHelpContext)
  206.          : Sysutils::Exception(Msg, AHelpContext) { }
  207.     /* Exception.CreateFmtHelp */ __fastcall EUserCanceled(const System::AnsiString Msg, const System::TVarRec 
  208.         * Args, const int Args_Size, int AHelpContext) : Sysutils::Exception(Msg, Args, Args_Size, AHelpContext
  209.         ) { }
  210.     /* Exception.CreateResHelp */ __fastcall EUserCanceled(int Ident, int AHelpContext) : Sysutils::Exception(
  211.         Ident, AHelpContext) { }
  212.     /* Exception.CreateResFmtHelp */ __fastcall EUserCanceled(int Ident, const System::TVarRec * Args, 
  213.         const int Args_Size, int AHelpContext) : Sysutils::Exception(Ident, Args, Args_Size, AHelpContext)
  214.          { }
  215.     
  216. public:
  217.     /* TObject.Destroy */ __fastcall virtual ~EUserCanceled(void) { }
  218.     
  219. };
  220.  
  221. class DELPHICLASS EInvalidPassword;
  222. class PASCALIMPLEMENTATION EInvalidPassword : public Sysutils::Exception 
  223. {
  224.     typedef Sysutils::Exception inherited;
  225.     
  226. public:
  227.     /* Exception.Create */ __fastcall EInvalidPassword(const System::AnsiString Msg) : Sysutils::Exception(
  228.         Msg) { }
  229.     /* Exception.CreateFmt */ __fastcall EInvalidPassword(const System::AnsiString Msg, const System::TVarRec 
  230.         * Args, const int Args_Size) : Sysutils::Exception(Msg, Args, Args_Size) { }
  231.     /* Exception.CreateRes */ __fastcall EInvalidPassword(int Ident, Extended Dummy) : Sysutils::Exception(
  232.         Ident, Dummy) { }
  233.     /* Exception.CreateResFmt */ __fastcall EInvalidPassword(int Ident, const System::TVarRec * Args, const 
  234.         int Args_Size) : Sysutils::Exception(Ident, Args, Args_Size) { }
  235.     /* Exception.CreateHelp */ __fastcall EInvalidPassword(const System::AnsiString Msg, int AHelpContext
  236.         ) : Sysutils::Exception(Msg, AHelpContext) { }
  237.     /* Exception.CreateFmtHelp */ __fastcall EInvalidPassword(const System::AnsiString Msg, const System::TVarRec 
  238.         * Args, const int Args_Size, int AHelpContext) : Sysutils::Exception(Msg, Args, Args_Size, AHelpContext
  239.         ) { }
  240.     /* Exception.CreateResHelp */ __fastcall EInvalidPassword(int Ident, int AHelpContext) : Sysutils::
  241.         Exception(Ident, AHelpContext) { }
  242.     /* Exception.CreateResFmtHelp */ __fastcall EInvalidPassword(int Ident, const System::TVarRec * Args
  243.         , const int Args_Size, int AHelpContext) : Sysutils::Exception(Ident, Args, Args_Size, AHelpContext
  244.         ) { }
  245.     
  246. public:
  247.     /* TObject.Destroy */ __fastcall virtual ~EInvalidPassword(void) { }
  248.     
  249. };
  250.  
  251. class DELPHICLASS EBiggerThanUncompressed;
  252. class PASCALIMPLEMENTATION EBiggerThanUncompressed : public Sysutils::Exception 
  253. {
  254.     typedef Sysutils::Exception inherited;
  255.     
  256. public:
  257.     /* Exception.Create */ __fastcall EBiggerThanUncompressed(const System::AnsiString Msg) : Sysutils::
  258.         Exception(Msg) { }
  259.     /* Exception.CreateFmt */ __fastcall EBiggerThanUncompressed(const System::AnsiString Msg, const System::TVarRec 
  260.         * Args, const int Args_Size) : Sysutils::Exception(Msg, Args, Args_Size) { }
  261.     /* Exception.CreateRes */ __fastcall EBiggerThanUncompressed(int Ident, Extended Dummy) : Sysutils::
  262.         Exception(Ident, Dummy) { }
  263.     /* Exception.CreateResFmt */ __fastcall EBiggerThanUncompressed(int Ident, const System::TVarRec * 
  264.         Args, const int Args_Size) : Sysutils::Exception(Ident, Args, Args_Size) { }
  265.     /* Exception.CreateHelp */ __fastcall EBiggerThanUncompressed(const System::AnsiString Msg, int AHelpContext
  266.         ) : Sysutils::Exception(Msg, AHelpContext) { }
  267.     /* Exception.CreateFmtHelp */ __fastcall EBiggerThanUncompressed(const System::AnsiString Msg, const 
  268.         System::TVarRec * Args, const int Args_Size, int AHelpContext) : Sysutils::Exception(Msg, Args, Args_Size
  269.         , AHelpContext) { }
  270.     /* Exception.CreateResHelp */ __fastcall EBiggerThanUncompressed(int Ident, int AHelpContext) : Sysutils::
  271.         Exception(Ident, AHelpContext) { }
  272.     /* Exception.CreateResFmtHelp */ __fastcall EBiggerThanUncompressed(int Ident, const System::TVarRec 
  273.         * Args, const int Args_Size, int AHelpContext) : Sysutils::Exception(Ident, Args, Args_Size, AHelpContext
  274.         ) { }
  275.     
  276. public:
  277.     /* TObject.Destroy */ __fastcall virtual ~EBiggerThanUncompressed(void) { }
  278.     
  279. };
  280.  
  281. class DELPHICLASS ENotEnoughRoom;
  282. class PASCALIMPLEMENTATION ENotEnoughRoom : public Sysutils::Exception 
  283. {
  284.     typedef Sysutils::Exception inherited;
  285.     
  286. public:
  287.     /* Exception.Create */ __fastcall ENotEnoughRoom(const System::AnsiString Msg) : Sysutils::Exception(
  288.         Msg) { }
  289.     /* Exception.CreateFmt */ __fastcall ENotEnoughRoom(const System::AnsiString Msg, const System::TVarRec 
  290.         * Args, const int Args_Size) : Sysutils::Exception(Msg, Args, Args_Size) { }
  291.     /* Exception.CreateRes */ __fastcall ENotEnoughRoom(int Ident, Extended Dummy) : Sysutils::Exception(
  292.         Ident, Dummy) { }
  293.     /* Exception.CreateResFmt */ __fastcall ENotEnoughRoom(int Ident, const System::TVarRec * Args, const 
  294.         int Args_Size) : Sysutils::Exception(Ident, Args, Args_Size) { }
  295.     /* Exception.CreateHelp */ __fastcall ENotEnoughRoom(const System::AnsiString Msg, int AHelpContext
  296.         ) : Sysutils::Exception(Msg, AHelpContext) { }
  297.     /* Exception.CreateFmtHelp */ __fastcall ENotEnoughRoom(const System::AnsiString Msg, const System::TVarRec 
  298.         * Args, const int Args_Size, int AHelpContext) : Sysutils::Exception(Msg, Args, Args_Size, AHelpContext
  299.         ) { }
  300.     /* Exception.CreateResHelp */ __fastcall ENotEnoughRoom(int Ident, int AHelpContext) : Sysutils::Exception(
  301.         Ident, AHelpContext) { }
  302.     /* Exception.CreateResFmtHelp */ __fastcall ENotEnoughRoom(int Ident, const System::TVarRec * Args, 
  303.         const int Args_Size, int AHelpContext) : Sysutils::Exception(Ident, Args, Args_Size, AHelpContext)
  304.          { }
  305.     
  306. public:
  307.     /* TObject.Destroy */ __fastcall virtual ~ENotEnoughRoom(void) { }
  308.     
  309. };
  310.  
  311. class DELPHICLASS ECantWriteUCF;
  312. class PASCALIMPLEMENTATION ECantWriteUCF : public Sysutils::Exception 
  313. {
  314.     typedef Sysutils::Exception inherited;
  315.     
  316. public:
  317.     /* Exception.Create */ __fastcall ECantWriteUCF(const System::AnsiString Msg) : Sysutils::Exception(
  318.         Msg) { }
  319.     /* Exception.CreateFmt */ __fastcall ECantWriteUCF(const System::AnsiString Msg, const System::TVarRec 
  320.         * Args, const int Args_Size) : Sysutils::Exception(Msg, Args, Args_Size) { }
  321.     /* Exception.CreateRes */ __fastcall ECantWriteUCF(int Ident, Extended Dummy) : Sysutils::Exception(
  322.         Ident, Dummy) { }
  323.     /* Exception.CreateResFmt */ __fastcall ECantWriteUCF(int Ident, const System::TVarRec * Args, const 
  324.         int Args_Size) : Sysutils::Exception(Ident, Args, Args_Size) { }
  325.     /* Exception.CreateHelp */ __fastcall ECantWriteUCF(const System::AnsiString Msg, int AHelpContext)
  326.          : Sysutils::Exception(Msg, AHelpContext) { }
  327.     /* Exception.CreateFmtHelp */ __fastcall ECantWriteUCF(const System::AnsiString Msg, const System::TVarRec 
  328.         * Args, const int Args_Size, int AHelpContext) : Sysutils::Exception(Msg, Args, Args_Size, AHelpContext
  329.         ) { }
  330.     /* Exception.CreateResHelp */ __fastcall ECantWriteUCF(int Ident, int AHelpContext) : Sysutils::Exception(
  331.         Ident, AHelpContext) { }
  332.     /* Exception.CreateResFmtHelp */ __fastcall ECantWriteUCF(int Ident, const System::TVarRec * Args, 
  333.         const int Args_Size, int AHelpContext) : Sysutils::Exception(Ident, Args, Args_Size, AHelpContext)
  334.          { }
  335.     
  336. public:
  337.     /* TObject.Destroy */ __fastcall virtual ~ECantWriteUCF(void) { }
  338.     
  339. };
  340.  
  341. typedef void __fastcall (__closure *TStartUnzipInfo)(System::TObject* Sender, int NumFiles, double TotalBytes
  342.     , bool &StopNow);
  343.  
  344. typedef void __fastcall (__closure *TStartUnZipEvent)(System::TObject* Sender, int FileIndex, System::AnsiString 
  345.     &FName, bool &Skip);
  346.  
  347. typedef void __fastcall (__closure *TEndUnZipEvent)(System::TObject* Sender, int FileIndex, System::AnsiString 
  348.     FName);
  349.  
  350. typedef void __fastcall (__closure *TFilePercentDone)(System::TObject* Sender, int Percent);
  351.  
  352. typedef void __fastcall (__closure *TTotalPercentDone)(System::TObject* Sender, int Percent);
  353.  
  354. typedef void __fastcall (__closure *TPromptForOverwrite)(System::TObject* Sender, bool &OverWriteIt, 
  355.     int FileIndex, System::AnsiString &FName);
  356.  
  357. typedef void __fastcall (__closure *TSkippingFile)(System::TObject* Sender, TSkipReason Reason, System::AnsiString 
  358.     FName, int FileIndex, bool &Retry);
  359.  
  360. typedef void __fastcall (__closure *TBadPassword)(System::TObject* Sender, int FileIndex, System::AnsiString 
  361.     &NewPassword);
  362.  
  363. typedef void __fastcall (__closure *TBadCRC)(System::TObject* Sender, int CalcCRC, int StoredCRC, int 
  364.     FileIndex);
  365.  
  366. typedef void __fastcall (__closure *TIncompleteZip)(System::TObject* Sender, TIncompleteZipMode &IncompleteMode
  367.     );
  368.  
  369. typedef void __fastcall (__closure *TGetNextDisk)(System::TObject* Sender, int NextDisk, System::AnsiString 
  370.     &FName);
  371.  
  372. typedef void __fastcall (__closure *TUnZipComplete)(System::TObject* sender, int FileCount);
  373.  
  374. typedef void __fastcall (__closure *TGetNextBuffer)(System::TObject* Sender, char * &Buffer, System::AnsiString 
  375.     FName, int AmountUsed, int BufferNum, bool &Quit);
  376.  
  377. class DELPHICLASS TVCLUnZip;
  378. class PASCALIMPLEMENTATION TVCLUnZip : public Classes::TComponent 
  379. {
  380.     typedef Classes::TComponent inherited;
  381.     
  382. private:
  383.     System::AnsiString FZipName;
  384.     System::AnsiString FDestDir;
  385.     TZipSortMode FSortMode;
  386.     bool FReCreateDir;
  387.     TUZOverwriteMode FOverwriteMode;
  388.     Classes::TStrings* FFilesList;
  389.     bool FDoAll;
  390.     System::AnsiString FPassword;
  391.     TIncompleteZipMode FIncompleteZipMode;
  392.     bool FKeepZipOpen;
  393.     bool FDoProcessMessages;
  394.     int FNumDisks;
  395.     bool FRetainAttributes;
  396.     int FThisVersion;
  397.     bool FReplaceReadOnly;
  398.     int FNumSelected;
  399.     int FBufferLength;
  400.     bool FImproperZip;
  401.     TStartUnzipInfo FOnStartUnzipInfo;
  402.     TStartUnZipEvent FOnStartUnZip;
  403.     TEndUnZipEvent FOnEndUnZip;
  404.     TPromptForOverwrite FOnPromptForOverwrite;
  405.     TBadPassword FOnBadPassword;
  406.     TBadCRC FOnBadCRC;
  407.     TIncompleteZip FOnInCompleteZip;
  408.     TUnZipComplete FOnUnzipComplete;
  409.     TGetNextBuffer FOnGetNextBuffer;
  410.     bool __fastcall ProcessIntegrityCheck(int Index);
  411.     
  412. protected:
  413.     TFilePercentDone FOnFilePercentDone;
  414.     TTotalPercentDone FOnTotalPercentDone;
  415.     TSkippingFile FOnSkippingFile;
  416.     TGetNextDisk FOnGetNextDisk;
  417.     Classes::TStream* FArchiveStream;
  418.     bool FBusy;
  419.     System::AnsiString FRootDir;
  420.     bool FTestMode;
  421.     bool FFlushFilesOnClose;
  422.     int FBufferedStreamSize;
  423.     bool ArchiveIsStream;
  424.     bool FCheckDiskLabels;
  425.     TMultiMode FMultiMode;
  426.     Kpzipobj::TZipHeaderInfo* file_info;
  427.     Kpzipobj::TSortedZip* files;
  428.     Kpzipobj::TSortedZip* sortfiles;
  429.     System::TDateTime filesDate;
  430.     bool ZipIsBad;
  431.     int CurrentDisk;
  432.     Classes::TStream* theZipFile;
  433.     int Crc32Val;
  434.     Kpzipobj::local_file_header lrec;
  435.     Kpzipobj::central_file_header crec;
  436.     Kpzipobj::TEndCentral* ecrec;
  437.     int ZipCommentPos;
  438.     bool UnZippingSelected;
  439.     System::AnsiString tmpMStr;
  440.     int Key[3];
  441.     bool CancelOperation;
  442.     Classes::TStream* ZipStream;
  443.     bool StreamZipping;
  444.     bool MemZipping;
  445.     char *MemBuffer;
  446.     int MemLen;
  447.     int MemLeft;
  448.     char *CurrMem;
  449.     bool Fixing;
  450.     bool DR;
  451.     double TotalUncompressedSize;
  452.     double TotalBytesDone;
  453.     void __fastcall OpenZip(void);
  454.     void __fastcall CloseZip(void);
  455.     int __fastcall GetCount(void);
  456.     void __fastcall GetFileInfo(Classes::TStream* infofile);
  457.     System::AnsiString __fastcall GetZipName(void);
  458.     virtual void __fastcall SetZipName(System::AnsiString ZName);
  459.     void __fastcall SetArchiveStream(Classes::TStream* theStream);
  460.     System::AnsiString __fastcall GetDestDir(void);
  461.     void __fastcall SetDestDir(System::AnsiString DDir);
  462.     void __fastcall SetRootDir(System::AnsiString Value);
  463.     int __fastcall UnZipFiles(Classes::TStream* zip_in_file);
  464.     int __fastcall UpdCRC(Byte Octet, int Crc);
  465.     Classes::TStream* __fastcall SwapDisk(int NewDisk);
  466.     void __fastcall SetFileComment(int Index, System::AnsiString theComment);
  467.     void __fastcall SetZipComment(System::AnsiString theComment);
  468.     void __fastcall WriteNumDisks(int NumberOfDisks);
  469.     void __fastcall NewDiskEvent(System::TObject* Sender, Classes::TStream* &S);
  470.     void __fastcall SetThisVersion(int v);
  471.     virtual bool __fastcall GetCheckDiskLabels(void);
  472.     virtual void __fastcall SetCheckDiskLabels(bool Value);
  473.     virtual TMultiMode __fastcall GetMultiMode(void);
  474.     virtual void __fastcall SetMultiMode(TMultiMode Value);
  475.     void __fastcall SetFilesList(Classes::TStrings* Value);
  476.     System::AnsiString __fastcall GetFilename(int Index);
  477.     System::AnsiString __fastcall GetPathname(int Index);
  478.     System::AnsiString __fastcall GetFullname(int Index);
  479.     Word __fastcall GetCompressMethod(int Index);
  480.     System::AnsiString __fastcall GetCompressMethodStr(int Index);
  481.     System::TDateTime __fastcall GetDateTime(int Index);
  482.     int __fastcall GetCrc(int Index);
  483.     int __fastcall GetCompressedSize(int Index);
  484.     int __fastcall GetUnCompressedSize(int Index);
  485.     int __fastcall GetExternalFileAttributes(int Index);
  486.     bool __fastcall GetIsEncrypted(int Index);
  487.     bool __fastcall GetHasComment(int Index);
  488.     System::AnsiString __fastcall GetFileComment(int Index);
  489.     bool __fastcall GetFileIsOK(int Index);
  490.     int __fastcall GetDiskNo(int Index);
  491.     bool __fastcall GetSelected(int Index);
  492.     void __fastcall SetSelected(int Index, bool Value);
  493.     bool __fastcall GetZipHasComment(void);
  494.     System::AnsiString __fastcall GetZipComment(void);
  495.     int __fastcall GetZipSize(void);
  496.     Byte __fastcall DecryptTheHeader(System::AnsiString Passwrd, Classes::TStream* zfile);
  497.     void __fastcall update_keys(char ch);
  498.     Byte __fastcall decrypt_byte(void);
  499.     void __fastcall Init_Keys(System::AnsiString Passwrd);
  500.     void __fastcall decrypt_buff(Windows::PByte bufptr, int num_to_decrypt);
  501.     void __fastcall Update_CRC_buff(Windows::PByte bufptr, int num_to_update);
  502.     void __fastcall DefaultGetNextDisk(System::TObject* Sender, int NextDisk, System::AnsiString &FName
  503.         );
  504.     virtual void __fastcall Loaded(void);
  505.     
  506. public:
  507.     __fastcall virtual TVCLUnZip(Classes::TComponent* AOwner);
  508.     __fastcall virtual ~TVCLUnZip(void);
  509.     virtual void __fastcall Assign(Classes::TPersistent* Source);
  510.     void __fastcall ReadZip(void);
  511.     int __fastcall UnZip(void);
  512.     int __fastcall UnZipSelected(void);
  513.     void __fastcall ClearSelected(void);
  514.     void __fastcall ClearZip(void);
  515.     void __fastcall FillList(Classes::TStrings* FilesList);
  516.     void __fastcall Sort(Kpzipobj::TZipSortMode SMode);
  517.     void __fastcall CancelTheOperation(void);
  518.     void __fastcall AskForNewDisk(int NewDisk);
  519.     int __fastcall UnZipToStream(Classes::TStream* theStream, System::AnsiString FName);
  520.     int __fastcall UnZipToStreamByIndex(Classes::TStream* theStream, int Index);
  521.     int __fastcall UnZipToBuffer(char * &Buffer, System::AnsiString FName);
  522.     int __fastcall UnZipToBufferByIndex(char * &Buffer, int Index);
  523.     void __fastcall ResetFileIsOK(int Index);
  524.     bool __fastcall CheckArchive(void);
  525.     Byte __fastcall DecryptHeaderByte(System::AnsiString Passwrd, const Byte * dh);
  526.     void __fastcall GetDecryptHeaderPtr(int Index, Windows::PByte dhPtr);
  527.     Byte __fastcall DecryptHeaderByteByPtr(System::AnsiString Passwrd, Windows::PByte dh);
  528.     __property Classes::TStream* ArchiveStream = {read=theZipFile, write=SetArchiveStream};
  529.     __property int Count = {read=GetCount, nodefault};
  530.     __property System::AnsiString Filename[int Index] = {read=GetFilename};
  531.     __property System::AnsiString Pathname[int Index] = {read=GetPathname};
  532.     __property System::AnsiString FullName[int Index] = {read=GetFullname};
  533.     __property Word CompressMethod[int Index] = {read=GetCompressMethod};
  534.     __property System::AnsiString CompressMethodStr[int Index] = {read=GetCompressMethodStr};
  535.     __property System::TDateTime DateTime[int Index] = {read=GetDateTime};
  536.     __property int Crc[int Index] = {read=GetCrc};
  537.     __property int CompressedSize[int Index] = {read=GetCompressedSize};
  538.     __property int UnCompressedSize[int Index] = {read=GetUnCompressedSize};
  539.     __property int ExternalFileAttributes[int Index] = {read=GetExternalFileAttributes};
  540.     __property bool IsEncrypted[int Index] = {read=GetIsEncrypted};
  541.     __property bool FileHasComment[int Index] = {read=GetHasComment};
  542.     __property System::AnsiString FileComment[int Index] = {read=GetFileComment};
  543.     __property bool FileIsOK[int Index] = {read=GetFileIsOK};
  544.     __property int DiskNo[int Index] = {read=GetDiskNo};
  545.     __property bool Selected[int Index] = {read=GetSelected, write=SetSelected};
  546.     __property System::AnsiString ZipComment = {read=GetZipComment};
  547.     __property System::AnsiString Password = {read=FPassword, write=FPassword};
  548.     __property bool ZipHasComment = {read=GetZipHasComment, nodefault};
  549.     __property int NumDisks = {read=FNumDisks, nodefault};
  550.     __property int ZipSize = {read=GetZipSize, nodefault};
  551.     __property bool CheckDiskLabels = {read=GetCheckDiskLabels, write=SetCheckDiskLabels, default=1};
  552.     __property TMultiMode MultiMode = {read=GetMultiMode, write=SetMultiMode, default=0};
  553.     __property bool Busy = {read=FBusy, default=0};
  554.     __property int NumSelected = {read=FNumSelected, nodefault};
  555.     __property int BufferLength = {read=FBufferLength, write=FBufferLength, default=0};
  556.     __property bool ImproperZip = {read=FImproperZip, default=0};
  557.     __property int BufferedStreamSize = {read=FBufferedStreamSize, write=FBufferedStreamSize, default=8192
  558.         };
  559.     
  560. __published:
  561.     __property int ThisVersion = {read=FThisVersion, write=SetThisVersion, default=222};
  562.     __property System::AnsiString ZipName = {read=GetZipName, write=SetZipName};
  563.     __property System::AnsiString DestDir = {read=GetDestDir, write=SetDestDir};
  564.     __property System::AnsiString RootDir = {read=FRootDir, write=SetRootDir};
  565.     __property Kpzipobj::TZipSortMode SortMode = {read=FSortMode, write=FSortMode, default=7};
  566.     __property bool RecreateDirs = {read=FReCreateDir, write=FReCreateDir, default=0};
  567.     __property TUZOverwriteMode OverwriteMode = {read=FOverwriteMode, write=FOverwriteMode, default=0};
  568.         
  569.     __property Classes::TStrings* FilesList = {read=FFilesList, write=SetFilesList};
  570.     __property bool DoAll = {read=FDoAll, write=FDoAll, default=0};
  571.     __property TIncompleteZipMode IncompleteZipMode = {read=FIncompleteZipMode, write=FIncompleteZipMode
  572.         , default=0};
  573.     __property bool KeepZipOpen = {read=FKeepZipOpen, write=FKeepZipOpen, default=0};
  574.     __property bool DoProcessMessages = {read=FDoProcessMessages, write=FDoProcessMessages, default=1};
  575.         
  576.     __property bool RetainAttributes = {read=FRetainAttributes, write=FRetainAttributes, default=1};
  577.     __property bool ReplaceReadOnly = {read=FReplaceReadOnly, write=FReplaceReadOnly, default=0};
  578.     __property bool FlushFilesOnClose = {read=FFlushFilesOnClose, write=FFlushFilesOnClose, default=0};
  579.         
  580.     __property TStartUnzipInfo OnStartUnZipInfo = {read=FOnStartUnzipInfo, write=FOnStartUnzipInfo};
  581.     __property TFilePercentDone OnFilePercentDone = {read=FOnFilePercentDone, write=FOnFilePercentDone}
  582.         ;
  583.     __property TTotalPercentDone OnTotalPercentDone = {read=FOnTotalPercentDone, write=FOnTotalPercentDone
  584.         };
  585.     __property TStartUnZipEvent OnStartUnZip = {read=FOnStartUnZip, write=FOnStartUnZip};
  586.     __property TEndUnZipEvent OnEndUnZip = {read=FOnEndUnZip, write=FOnEndUnZip};
  587.     __property TPromptForOverwrite OnPromptForOverwrite = {read=FOnPromptForOverwrite, write=FOnPromptForOverwrite
  588.         };
  589.     __property TSkippingFile OnSkippingFile = {read=FOnSkippingFile, write=FOnSkippingFile};
  590.     __property TBadPassword OnBadPassword = {read=FOnBadPassword, write=FOnBadPassword};
  591.     __property TBadCRC OnBadCRC = {read=FOnBadCRC, write=FOnBadCRC};
  592.     __property TIncompleteZip OnInCompleteZip = {read=FOnInCompleteZip, write=FOnInCompleteZip};
  593.     __property TGetNextDisk OnGetNextDisk = {read=FOnGetNextDisk, write=FOnGetNextDisk};
  594.     __property TUnZipComplete OnUnZipComplete = {read=FOnUnzipComplete, write=FOnUnzipComplete};
  595.     __property TGetNextBuffer OnGetNextBuffer = {read=FOnGetNextBuffer, write=FOnGetNextBuffer};
  596. };
  597.  
  598. //-- var, const, procedure ---------------------------------------------------
  599. #define kpThisVersion (Byte)(222)
  600. #define DEF_BUFSTREAMSIZE (Word)(8192)
  601. extern PACKAGE Dialogs::TOpenDialog* OpenZipDlg;
  602. extern PACKAGE bool __fastcall DelphiIsRunning(void);
  603. extern PACKAGE void __fastcall Register(void);
  604.  
  605. }    /* namespace Vclunzip */
  606. #if !defined(NO_IMPLICIT_NAMESPACE_USE)
  607. using namespace Vclunzip;
  608. #endif
  609. //-- end unit ----------------------------------------------------------------
  610. #endif    // VCLUnZip
  611.